<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .actived {
            color: red;
        }
        .mylink{
            cursor: pointer;
        }
    </style>
</head>
<body>
<h1>Vue的样式绑定</h1>
<hr>
<div id="app">
    <div @click="handleClick" class="mylink" :class="{actived:changeStyle}">Hello World</div>
</div>
<!--使用CDN方式引入vue-->
<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.7.4/vue.min.js"></script>

<script>

    let vm = new Vue({
        el: '#app',
        data: {
            changeStyle: false
        },
        methods: {
            handleClick: function () {
                this.changeStyle = !this.changeStyle;
            }
        }
    })
</script>
</body>
</html>
